﻿//
// Copyright 2008-2011 by Burt Harris
// Licensed under the Microsoft Public License (Ms-PL)
// See: http://www.codeplex.com/yaml/license
//

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace YaTools.Yaml.UnitTests
{
    /// <summary>
    /// Summary description for TagTests
    /// </summary>
    [TestClass]
    public class TagTests
    {
        [TestMethod]
        public void EqualityTag()
        {
            Assert.AreEqual(Tag.Integer, Tag.Integer);
        }

        [TestMethod]
        public void EqualityNew()
        {
            Assert.AreEqual(Tag.Map, new Tag("tag:yaml.org,2002:map", Kind.Mapping));
        }


        [TestMethod]
        public void InEqualityNew()
        {
            Assert.AreEqual(Tag.Map, new Tag("tag:yaml.org,2002:map", Kind.Mapping));
        }

        [TestMethod]
        public void EqualityHttpScheme()
        {
            Assert.AreEqual(
                new Tag("http://www.Microsoft.com", Kind.Scalar),
                new Tag("http://www.Microsoft.com", Kind.Scalar));
        }

        [TestMethod]
        public void EqualityHttpSchemeCase()
        {
            Assert.AreEqual(
                new Tag("http://www.Microsoft.com", Kind.Scalar),
                new Tag("HTTP://www.Microsoft.com", Kind.Scalar));
        }

        [TestMethod]
        public void InEqualityHttpPathCase()
        {
            Assert.AreEqual(
                new Tag("http://www.Microsoft.com/foo", Kind.Scalar),
                new Tag("http://www.Microsoft.com/foo", Kind.Scalar));
        }

        [TestMethod]
        public void InEqualityTagNodeCase()
        {
            Assert.AreNotEqual(
                new Tag("tag:yaml.codeplex.com,2010:foo", Kind.Scalar),
                new Tag("tag:yaml.Codeplex.com,2010:foo", Kind.Scalar));
        }

        [TestMethod]
        public void InEqualityTagPtjerCase()
        {
            Assert.AreNotEqual(
                new Tag("tag:yaml.codeplex.com,2010:foo", Kind.Scalar),
                new Tag("tag:yaml.codeplex.com,2010:Foo", Kind.Scalar));
        }

        [TestMethod]
        public void InEquality()
        {
            Assert.AreNotEqual(Tag.String, Tag.Integer);
        }

        [TestMethod]
        public void InEqualityOfKind()
        {
            Assert.AreNotEqual(Tag.Integer, new Tag(Tag.Integer.Name, Kind.Mapping));
        }
    }
}
